/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef RECPTPRINTER_HILOG_WRAPPER_H
#define RECPTPRINTER_HILOG_WRAPPER_H

#include "hilog/log.h"
#include "hilog_wrapper.h"
namespace SwanLink {
namespace Finance {
#define FINANCE_DOMAIN_RECEIPTPRINTER(offset)  FINANCE_DOMAIN_BASE(2, offset)

#ifdef RECPTPRINTER_HILOGF
#undef RECPTPRINTER_HILOGF
#endif

#ifdef RECPTPRINTER_HILOGE
#undef RECPTPRINTER_HILOGE
#endif

#ifdef RECPTPRINTER_HILOGW
#undef RECPTPRINTER_HILOGW
#endif

#ifdef RECPTPRINTER_HILOGI
#undef RECPTPRINTER_HILOGI
#endif

#ifdef RECPTPRINTER_HILOGD
#undef RECPTPRINTER_HILOGD
#endif

enum RECPTPRINTER_MODULE {
    RECPTPRINTER_UTIL = 0,
    RECPTPRINTER_KITS,
    RECPTPRINTER_INNERKITS,
    RECPTPRINTER_JS_NAPI,
    RECPTPRINTER_SRV,
    RECPTPRINTER_PLUGIN,
    RECPTPRINTER_TEST,
    RECPTPRINTER_BUTT
};
// In order to improve performance, do not check the module range.

static constexpr OHOS::HiviewDFX::HiLogLabel RECPTPRINTER_LABEL[RECPTPRINTER_BUTT] = {
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_UTIL),            "RecptprinterUtils"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_KITS),            "RecptprinterKits"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_INNERKITS),       "RecptprinterInnerKits"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_JS_NAPI),         "RecptprinterJsNapi"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_SRV),             "RecptprinterSrv"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_PLUGIN),          "RecptprinterPlugin"},
    {LOG_CORE, FINANCE_DOMAIN_RECEIPTPRINTER(RECPTPRINTER_TEST),            "RecptprinterTest"}
};

// Besides, make sure module is less than POWERMGR_MODULE_BUTT.
#define RECPTPRINTER_HILOGF(module, ...) (void)OHOS::HiviewDFX::HiLog::Fatal(RECPTPRINTER_LABEL[module], __FORMATED(__VA_ARGS__))
#define RECPTPRINTER_HILOGE(module, ...) (void)OHOS::HiviewDFX::HiLog::Error(RECPTPRINTER_LABEL[module], __FORMATED(__VA_ARGS__))
#define RECPTPRINTER_HILOGW(module, ...) (void)OHOS::HiviewDFX::HiLog::Warn(RECPTPRINTER_LABEL[module], __FORMATED(__VA_ARGS__))
#define RECPTPRINTER_HILOGI(module, ...) (void)OHOS::HiviewDFX::HiLog::Info(RECPTPRINTER_LABEL[module], __FORMATED(__VA_ARGS__))
#define RECPTPRINTER_HILOGD(module, ...) (void)OHOS::HiviewDFX::HiLog::Debug(RECPTPRINTER_LABEL[module], __FORMATED(__VA_ARGS__))

} // namespace Finance
} // namespace SwanLink

#endif // RECEIPTPRINTER_HILOG_WRAPPER_H
